package srk.java.demo.swt1;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Swt_time_selectionadaptor_1_9 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new RowLayout());

		DateTime time = new DateTime(shell, SWT.TIME);
		SelectionAdapter selectionadaptor = new SelectionAdapter1();
		time.addSelectionListener(selectionadaptor);

		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}

}

class SelectionAdapter1 extends SelectionAdapter {

	@Override
	public void widgetSelected(SelectionEvent e) {
		System.out.println("time changed");
	}

}